// 类的访问修饰符
export {}

class Person {
    name: string
    private age: number
    protected gender: boolean
    constructor(name: string, age: number) {
        this.name = name
        this.age = age
        this.gender = true
    }

    sayHi(msg:string):void {
        console.log(`I am ${this.name}`)
        console.log(this.age)
    }
}

class Student extends Person {
    private constructor(name: string, age: number) {
        super(name, age)
        console.log(this.gender)
    }
    static create(name: string, age: number) {
        return new Student(name, age)
    }
}

const tom = new Person('tom', 18)

console.log(tom.name)

// console.log(tom.age) // 私有成员不在再外部访问
// console.log(tom.gender) // 受保护成员不能在外部访问